From 19f69f6ac8ca5b8b9550fc695094c17e0a30d662 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Fri, 23 Aug 2019 08:13:20 +0200 Subject: [PATCH] cssrgbavalue: Add an opaque white singleton Used a few hundred times in the widget-factory. --- gtk/gtkcssrgbavalue.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c index f840160bde..ab3d180648 100644 --- a/gtk/gtkcssrgbavalue.c +++ b/gtk/gtkcssrgbavalue.c @@ -109,6 +109,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_RGBA = { static GtkCssValue transparent_black_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 0, 0, 0, 0 }}; static GtkCssValue transparent_white_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 1, 1, 1, 0 }}; +static GtkCssValue opaque_white_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 1, 1, 1, 1 }}; GtkCssValue * _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba) @@ -129,6 +130,13 @@ _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba) rgba->blue == 0) return _gtk_css_value_ref (&transparent_black_singleton); } + else if (gdk_rgba_is_opaque (rgba)) + { + if (rgba->red == 1 && + rgba->green == 1 && + rgba->blue == 1) + return _gtk_css_value_ref (&opaque_white_singleton); + } value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_RGBA); value->rgba = *rgba; -- 2.30.2